package com.regulareport.web.controller.report;

import com.regulareport.common.annotation.Log;
import com.regulareport.common.core.controller.BaseController;
import com.regulareport.common.core.domain.AjaxResult;
import com.regulareport.common.core.domain.entity.ReportFormsEdit;
import com.regulareport.common.enums.BusinessType;
import com.regulareport.form.domain.PageNotSearchVO;
import com.regulareport.form.service.IHeadSubSheetMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/sheetNameMap")
public class HeadSubMapController extends BaseController {
    @Autowired
    private IHeadSubSheetMapService headSubSheetMapService;

    /**
     * 查询Sheet列表
     */
    @PreAuthorize("@ss.hasPermi('report:sheetNameMap:list')")
    @GetMapping("/list")
    public List<ReportFormsEdit> list() {
        return headSubSheetMapService.selectHeadSubSheetMapList();
    }

    /**
     * 修改Sheet表映射
     */
    @PreAuthorize("@ss.hasPermi('report:sheetNameMap:edit')")
    @Log(title = "修改Sheet表映射", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody List<ReportFormsEdit> reportFormsEdits) {
        return toAjax(headSubSheetMapService.updateHeadSubSheetMaps(reportFormsEdits));
    }
}
